import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import Controllers.ControllerCreaterInterfece;
import TechStuff.RmiStarter;


public class ControllerCreater
extends RmiStarter implements ControllerCreaterInterfece {
	private ControllerCreaterInterfece model;

	public ControllerCreater() 
	{ super(null); 
		doCustomRmiHandling();
	}

	@Override
	public void doCustomRmiHandling() {
		String host = "localhost";
		try {
		    Registry registry = LocateRegistry.getRegistry(host);
		    model = (ControllerCreaterInterfece) registry.lookup(ControllerCreaterInterfece.name);
		} catch (Exception e) {
		    System.err.println("Client exception: " + e.toString());
		    e.printStackTrace();
		}		
	}

	@Override
	public String createBoard() throws RemoteException {
		return model.createBoard();
	}

	@Override
	public String createPawn() throws RemoteException {
		return model.createPawn();
	}

	@Override
	public String createKnight() throws RemoteException {
		return model.createKnight();
	}
	
	@Override
	public String createQueen() throws RemoteException {
		return model.createQueen();
	}

	@Override
	public String createRook() throws RemoteException {
		// TODO Auto-generated method stub
		return model.createRook();
	}
	
	@Override
	public String createKing() throws RemoteException {
		// TODO Auto-generated method stub
		return model.createKing();
	}
	
	@Override
	public String createBishop() throws RemoteException {
		// TODO Auto-generated method stub
		return model.createBishop();
	}

}
